import { GTable } from 'geminis-react';
import { useRef } from 'react';

export default () => {
  const table = useRef<any>();

  const schema = {
    headerTitle: '货品信息',
    data: {
      url: '/api/warehouse/basic/product',
      sort: 'no:asc',
    },
    action: {
      toolbar: {
        add: {
          form: {
            schemaPath: '/warehouse-pc/schema/basic/product/edit.json',
          },
        },
        delete: true,
        excelExport: true,
        excelImport: true,
      },
      row: {
        edit: {
          form: {
            schema: {
              data: {
                methodSubmit: 'post',
              },
            },
          },
        },
        delete: true,
      },
    },
  };

  return (
    <GTable
      ref={table}
      schemaPath="/warehouse-pc/schema/basic/product/table.json"
      schema={schema}
    />
  );
};
